import request from '@/utils/request'
// 获取分类列表
export function getCategories(params) {
  return request({
    url: '/categories',
    method: 'get',
    params
  })
}
// 获取分类数量
export function getCategoriesCount() {
  return request({
    url: `/categories/count`,
    method: 'get'
  })
}

// 新增分类
export function addCategory(data) {
  return request({
    url: `/categories`,
    method: 'post',
    data
  })
}

// 删除分类
export function delCategory(id) {
  return request({
    url: `/categories/${id}`,
    method: 'delete'

  })
}
// 获得指定分类
export function getCategoriesById(id) {
  return request({
    url: `/categories/${id}`,
    method: 'get'

  })
}
// 编辑分类
export function editCategoty(data) {
  return request({
    url: `/categories/${data.id}`,
    method: 'put',
    data
  })
}
